﻿CREATE TABLE [dbo].[Attachment]
(
    [AttachmentId] [uniqueidentifier] DEFAULT newid() NOT NULL,
	[Activity] [uniqueidentifier] NOT NULL, -- FK to Activity
	[Data] [varbinary](max) NULL,
	[Type] [int] DEFAULT 0 NOT NULL,
	[Description] [nvarchar](max) NULL,
    [IsDeleted] [bit] DEFAULT 0 NOT NULL,
	[CreatedBy] [uniqueidentifier] NOT NULL, -- FK to Person
	[CreatedOn] [datetime] DEFAULT getdate() NOT NULL,
    [LastChanged] [datetime] DEFAULT getdate() NOT NULL,
	[LastChangedBy] [uniqueidentifier] NOT NULL, -- FK to Person
	[TimeStamp] [timestamp] NOT NULL

CONSTRAINT [PK_Attachment] PRIMARY KEY CLUSTERED 
(
	[AttachmentId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO